package com.DesignMode.Singleton;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/10/10/8:42
 * @Description:
 * @Target:  获取枚举的构造器
 */
public class GetConstructorTest {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        DCLLazySingleton lazySingleton = DCLLazySingleton.getInstance();
        Class<DCLLazySingleton> aClass = (Class<DCLLazySingleton>) Class.forName("com.DesignMode.Singleton.DCLLazySingleton");


        Constructor<DCLLazySingleton> constructor1 = aClass.getDeclaredConstructor(null);
        constructor1.setAccessible(true);
        DCLLazySingleton o = constructor1.newInstance();
//        Object o1 = constructor1.newInstance();
        System.out.println(lazySingleton);
        System.out.println(o);
//        System.out.println(o1);

/*
        for (Constructor<?> constructor : constructors) {
            System.out.println(constructor);
        }

*/

    }
}
